-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resolved border collapse issue #1626 when border variants are mixed in button group #1637
fix: resolved border collapse issue #1626 when border variants are mixed in button group #1637
Conversation
🦋 Changeset detectedLatest commit: f89b7c9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@chongruei is attempting to deploy a commit to the NextUI Team on Vercel. A member of the Team first needs to authorize it. |
I am a new frontend developer who wants to improve programming skills through open source. I would like to know how you solved this problem. Could you please tell me the reasons and solutions for this problem? |
It wasn't solved. |
Hi @jguddas Sorry, I've missed radius as the default prop from theme.ts. Could you check this again? |
Can you add something like this as a story?
|
Can you tell me why you added an isIsolate attribute instead of directly taking the following approach? |
This can also solve this problem. |
Hi, @Digoler, it would be like without isIsolate After defining the isIsolate |
Hi! @jguddas I finally removed the negative value for the margin because it always covered the neighbor. It appears that removing the negative value for the margin has led to a situation where the border size doubles when the colors are the same. What are your thoughts on this issue? |
Another idea: We could use https://play.tailwindcss.com/Dl8H3CEOfv Edit: We would have to copy this into the next plugin: Than something like this would work: |
Hi @jguddas Thank you for your suggestion, which has provided me with a lot of inspiration. I have finally used an adjacent selector to check if the color and variant are the same. If they are the same, I will add a margin-left effect. This approach will cover all edge cases. |
variant: ["ghost", "bordered"], | ||
color: "default", | ||
className: | ||
"nextui-adjacent-default [&+.nextui-adjacent-default]:ml-[calc(theme(borderWidth.medium)*-1)]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer using data-color
and data-variant
over .nextui-adjacent-…
"nextui-adjacent-default [&+.nextui-adjacent-default]:ml-[calc(theme(borderWidth.medium)*-1)]", | |
[ | |
"[[data-variant=bordered][data-color=default]_+_&]:ml-[calc(theme(borderWidth.2)*-1)]", | |
"[[data-variant=ghost][data-color=default]_+_&]:ml-[calc(theme(borderWidth.2)*-1)]" | |
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add a file with all these selectors in ../utils
to make it reusable.
"nextui-adjacent-default [&+.nextui-adjacent-default]:ml-[calc(theme(borderWidth.medium)*-1)]", | |
utils.collapseAdjacentVariantBorders.default, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When thinking about it using a class name also isn't that bad, it's pretty much just like using peer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this would also work.
"nextui-adjacent-default [&+.nextui-adjacent-default]:ml-[calc(theme(borderWidth.medium)*-1)]", | |
"[&+.border-medium.border-default]:ml-[calc(theme(borderWidth.medium)*-1)]", |
The good part about this is we can add support for having different border widths other than medium
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jguddas
I have finally placed collapseAdjacentVariantBorders
in the utils
folder to make it reusable. This change also enables support for other border widths in the future.
Great work btw. This covers all the edge cases; I didn't think this would be achievable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge thanks @chongruei @jguddas ❤️
Closes #1626
📝 Description
The
radius
property does not work on the 'buttonGroup' component. Thevariant="bordered"
option does not display the correct borders.⛳️ Current behavior (updates)
The
radius
is always the same asmd
.The
border-left
is covered by margin-leftml-[calc(theme(borderWidth.medium)*-1)]
.🚀 New behavior
The
radius
now works, and the border is displayed correctly in thebuttonGroup
.💣 Is this a breaking change (Yes/No):
No
📝 Additional Information
Please kindly let me know if any suggestions.